assume cs:code
data segment
  db 10 dup (0)
data ends
code segment
  start: mov ax,data
         mov ds,ax
         mov ax,12666
         mov si,0
         call dtoc

         mov dh,8
         mov dl,3
         mov cl,2
         call show_str

         mov ax,4c00h
         int 21h

      dtoc: push cx
            push dx
            push ax
            mov di,0
        s1: mov cx,10
            mov dx,0
            div cx
            inc di
            mov cx,ax
            jcxz s2
            add dx,30h
            push dx
            jmp short s1
        s2: add dx,30h
            push dx

            mov cx,di
        s3: pop dx
            mov ds:[si],dl
            add si,1
            loop s3

            pop ax
            pop dx
            mov si,0
            pop cx
            ret

  show_str: mov ax,0B800h
            mov es,ax
            sub dh,1
            mov ah,0
            mov al,0a0h
            mul dh
            mov bx,ax
            mov ah,0
            mov al,2
            sub dl,1
            mul dl
            add bx,ax
            mov di,0
            mov al,cl
       sss: mov ch,0
            mov cl,ds:[si]
            jcxz s
            mov es:[bx+di],cl
            add si,1
            mov es:[bx+di+01h],al
            add di,2
            jmp short sss
         s: ret
code ends
end start
